<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>投标保证金管理</title>
	<meta name="decorator" content="default"/>
	<link rel="stylesheet" href="${ctxStatic}/common/bootstrap.min.css">
	<link rel="stylesheet" href="${ctxStatic}/common/AdminLTE.min.css">
	<link rel="stylesheet" href="${ctxStatic}/common/jeesite.css">
	<script src="${ctxStatic}/jquery-validation/1.16/jquery.validate.js"></script>
	<script src="${ctxStatic}/jquery-validation/1.16/jquery.validate.extend.js"></script>
	<script src="${ctxStatic}/jquery-validation/1.16/localization/messages_zh_CN.js"></script>
	<style type="text/css">
		#inputForm a{
			height: 30px;
			border-color: #ccc;
		}
		
		#contentTable tr{
			font-size: 13px;
		}
		#contentTable th{
			border-left: 1px solid #ddd;
			border-top: 1px solid #ddd;
		}
		#contentTable td{
			border-left: 1px solid #ddd;
			border-top: 1px solid #ddd;
		}
		
	</style>
	
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
			
			
		});
		
		// 保证金缴纳
		function payBidBondFn(supplierId){
			top.$.jBox.open("iframe:${ctx}/zx/bidBond/payBidBond?lzdId=${bidBond.lzdId}&sectionId=${bidBond.sectionId}&supplierId=" + supplierId, "保证金缴纳/退还",1000, 550,{
				buttons:{"提交":"ok", "关闭":true}, bottomText:"",submit:function(v, h, f){
					//nodes = selectedTree.getSelectedNodes();
					if (v == "ok"){
						//debugger;
						var flag = h.find("iframe")[0].contentWindow.subForm();
						if(!flag){
							return false;
						}else{
							location.reload();
						}
						
					} 
				}, loaded:function(h){
					$(".jbox-content", top.document).css("overflow-y","hidden");
				}
			});
		} 
		
		// 保证金缴纳
		function confirmPayFn(supplierId){
			top.$.jBox.open("iframe:${ctx}/zx/bidBond/confirmPay?lzdId=${bidBond.lzdId}&sectionId=${bidBond.sectionId}&supplierId=" + supplierId, "保证金缴纳/退还确认",800, 315,{
				buttons:{"提交":"ok", "关闭":true}, bottomText:"",submit:function(v, h, f){
					//nodes = selectedTree.getSelectedNodes();
					if (v == "ok"){
						//debugger;
						var flag = h.find("iframe")[0].contentWindow.subForm();
						if(!flag){
							return false;
						}else{
							location.reload();
						}
						
					} 
				}, loaded:function(h){
					$(".jbox-content", top.document).css("overflow-y","hidden");
				}
			});
		} 
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/zx/bidBond/">项目列表</a></li>
		<li class="active"><a href="${ctx}/zx/bidBond/form?lzdId=${bidBond.lzdId}&sectionId=${bidBond.sectionId}">投标保证金管理</a></li>
	</ul>
	<div class="main-content">
	  <div class="box box-main">
	  	<form:form id="inputForm" modelAttribute="bidBond" method="post" action="${ctx}/zx/bidBond/batchConfirmPay" class="form-horizontal">
			<form:hidden path="id"/>
			<form:hidden path="lzdId"/>
			<form:hidden path="sectionId"/>
			<sys:message content="${message}"/>	
			<div class="box-body">
				<div class="form-unit">项目基本信息
					<span style="float: right">
						<a href="${ctx}/zx/all/lzd/getLzdAllInfo?lzdId=${bidBond.lzdId}&sectionId=${bidBond.sectionId}&pageFlag=bidBond"> 查看更多项目详情>></a>
					</span>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 项目编码：<i class="fa icon-question hide"></i>
							</label>
							<div class="col-sm-8">
								<form:input path="lzd.proNo" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 项目名称：<i class="fa icon-question hide"></i>
							</label>
							<div class="col-sm-8">
								<form:input path="lzd.proName" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 采购单位：<i class="fa icon-question hide"></i>
							</label>
							<div class="col-sm-8">
								<form:input path="lzd.buyUnit" maxlength="255" class="form-control" cssStyle="height:30px" disabled="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 项目负责人：<i class="fa icon-question hide"></i>
							</label>
							<div class="col-sm-8">
								<form:input path="lzd.proPic" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
							</div>
						</div>
					</div>
				</div>
				<c:if test="${bidBond.lzd.isSubpackage eq '2'}">
					<div class="row">
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 项目预算(<font style="color: red">万元</font>)：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="lzd.budgetMoney" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 保证金：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="depositMoney" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
					</div>
				</c:if>
				<!-- 标段信息 -->
				<c:if test="${bidBond.lzd.isSubpackage eq '1'}">
					<div class="form-unit">标段信息</div>
					<div class="row">
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 标段名称：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="section.sectionName" maxlength="100" class="form-control required" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 项目预算(<font style="color: red">万元</font>)：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="section.budgetMoney" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 折扣：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="section.discount" maxlength="100" class="form-control required" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
						<div class="col-xs-6">
							<div class="form-group">
								<label class="control-label col-sm-4" title="">
									<span class="required hide">*</span> 保证金：<i class="fa icon-question hide"></i></label>
								<div class="col-sm-8">
									<form:input path="depositMoney" maxlength="100" class="form-control" cssStyle="height:30px" disabled="true"/>
								</div>
							</div>
						</div>
					</div>
				</c:if>
				<div class="form-unit" style="margin-bottom: 10px;">项目供应商信息</div>
				
				<table id="contentTable" class="table table-striped table-bordered table-condensed" style="margin-bottom: 20px">
					<thead>
						<tr>
							<th>单位名称</th>
							<!-- <th>缴纳金额</th> -->
							<th>缴纳情况</th>
							<th>退还情况</th>
							<th>联络人</th>
							<th>联系电话</th>
							<!-- <th>联系地址</th> -->
							<!-- <th>操作</th> -->
						</tr> 
					</thead>
					<tbody>
						<c:forEach items="${psList}" var="ps" varStatus="vs">
							<tr>
								<td>${ps.supplier.name}</td>
								<%-- <td>
									<fmt:formatNumber value="${ps.bidBond.paySum}" type="currency" pattern="￥.000000"/>
								</td> --%>
								<td>
									<%-- <c:if test="${empty ps.bidBond.payResult || ps.bidBond.payResult eq '0'}">
										<span class="label label-warning" style="margin-left: 5px;font-size: 90%;font-weight: 400;">未缴纳</span>
									</c:if>
									<c:if test="${ps.bidBond.payResult eq '1'}">
										<span class="label label-success" style="margin-left: 5px;font-size: 90%;font-weight: 400;">已缴纳</span>
									</c:if> --%>
									<input type="hidden" name="bbList[${vs.index}].supplierId" value="${ps.supplier.id}">
									<input type="hidden" name="bbList[${vs.index}].id" value="${ps.bidBond.id}">
									<form:select path="bbList[${vs.index}].payResult" cssStyle="width:100px">
										<form:option value="">请选择</form:option>
										<form:option value="1" htmlEscape="false" selected="${ps.bidBond.payResult eq '1' ? 'selected' : ''}">已缴纳</form:option>
										<form:option value="0" htmlEscape="false" selected="${ps.bidBond.payResult eq '0' ? 'selected' : ''}">未缴纳</form:option>
									</form:select>
								</td>
								<td>
									<%-- <c:if test="${empty ps.bidBond.returnableResult || ps.bidBond.returnableResult eq '0'}">
										<span class="label label-warning" style="margin-left: 5px;font-size: 90%;font-weight: 400;">未退还</span>
									</c:if>
									<c:if test="${ps.bidBond.returnableResult eq '1'}">
										<span class="label label-success" style="margin-left: 5px;font-size: 90%;font-weight: 400;">已退还</span>
									</c:if> --%>
									<form:select path="bbList[${vs.index}].returnableResult" cssStyle="width:100px">
										<form:option value="">请选择</form:option>
										<form:option value="1" htmlEscape="false" selected="${ps.bidBond.returnableResult eq '1' ? 'selected' : ''}">已退还</form:option>
										<form:option value="0" htmlEscape="false" selected="${ps.bidBond.returnableResult eq '0' ? 'selected' : ''}">未退还</form:option>
									</form:select>
								</td>
								<td>${ps.supplier.contacts}</td>
								<td>${ps.supplier.phone}</td>
								<%-- <td>${ps.supplier.address}</td> --%>
								<%-- <td>
									<shiro:hasPermission name="zx:bidBond:edit">
										<a href="javascript:void(0)" onclick="payBidBondFn('${ps.supplier.id}')">缴纳/退还保证金</a>&nbsp;&nbsp;&nbsp;&nbsp;
									</shiro:hasPermission>
									<shiro:hasPermission name="zx:bidBond:confirmPay">
										<a href="javascript:void(0)" onclick="confirmPayFn('${ps.supplier.id}')">缴纳/退还确认</a>
									</shiro:hasPermission>				
								</td> --%>
							</tr>
						</c:forEach>
					</tbody>
				</table>								
			<div class="form-actions" style="background-color: #fff;padding-left: 0px">
				<c:if test="${fn:length(psList) > 0}">
					<shiro:hasPermission name="zx:bidBond:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
				</c:if>
				<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)" style="background-color: #e7e7e7;"/>
			</div>
		</form:form>
	  </div>
	</div>
</body>
</html>